<div id="control_right" height:100%;>
  <a href="/soj/php/manager/manager_problem_add.php">添加试题</a>
  {? if $isnotempty ?}
  <div id="problem_search">
	<form  action="/soj/php/manager/manager_problem_search.php" method="post">
		<label for="search">search:</label>
		<input type="text" name="search" class="search_text"/>
		<label for="search_option">with</label>
		<select name="option">
			<option value="no">problem No.</option>
			<option value="source">source</option>
		</select>
		<input type="submit" value="serch" />
	</form>
  </div>
  {?* 大于30个结果才会使用置顶的导航栏 *?}
	{? if $problem_num >= 30 ?}
	<div id="pager">
	{? $links ?}
	</div> 
  {? /if ?}
  <table bgcolor="#00CCCC">
   {? if $problem_num ?}
	<caption>Problems totle : {? $problem_num ?}</caption>
    {? /if ?}
   <tr>
       {?* 为了实现灵活性，第一个foreach显示所有的标题，这样即便结果集发生了变化，模板文件也不需要修改 *?}
	<tr>
	{? if $titles|@is_array ?}
			{? foreach key=key item=title from=$titles ?}
				{? if $title eq "problem_no" ?}
					<th class="problem_no_th">No.</th>
				{? else ?}
					{? if $title eq "best_user" ?}
						<th class="best_user_th">Best User</th>
					{? else ?}
						{? if $title eq "submit_count" ?}
						
							<th class="submit_count_th">Submit</th>
							
						{? else ?}
							
							{? if $title eq "ac_count" ?}
								
								<th class="ac_count_th">AC</th>
							
							{? else ?}
						
							<th>{? $title|replace:"_":" "|capitalize ?}</th>
						
							{? /if ?}
						{? /if ?}
					{? /if ?}
				{? /if ?}
			{? /foreach ?}
		{? else ?}
			{? "error" ?}
	{? /if ?}
        <th></th><th></th>
	</tr>
{?* 设置一个指示变量,用来生成条文表格 *?}
	{? assign var=spec value=0 ?}
	{? if $problems|@is_array ?}
		{? foreach key=key item=problem from=$problems ?}
			{? assign var=spec value=$spec+1 ?}
			
			<tr {? if $spec%2 eq 0 ?} class="spec" {? /if ?}>
				
				{? foreach key=key item=item from=$problem ?}
					{? if $key eq "problem_no" ?}
						{? assign var="no" value=$item ?}
					
						<td>{? $item ?}</td>
				
					{? else ?}
						{? if $key eq "title" ?}
						
							<td>{? $item ?}</td>
						
						{? else ?}
							
							{? if ($key eq "best_user") and !$item ?}
							
								<td>{? $item ?}</td>
							
							{? else ?}
								{? if $key eq "ac_count" ?}
									
									<td class="ac_count_td">{? $item ?}</td>
								
								{? else ?}

									{? if $key eq "submit_count" ?}
										
										<td class="submit_count_td">{? $item ?}</td>

									{? else ?}
								
										<td>{? $item ?}</td>

									{? /if ?}
								{? /if ?}
							{? /if ?}
						{? /if ?}
					{? /if ?}					
				{? /foreach ?}
				<td class="for manager"><a href="/soj/php/manager/manager_problem_detail.php?no={? $no ?}">管理</a></td>
				<td class="for manager"><a href="/soj/php/manager/manager_problem_delete.php?no={? $no ?}"  onClick="return confirm('真的要删除?')">删除</a></td>			
				</tr>
		
			{? /foreach ?}
		{? else ?}
			{? "error" ?}
	{? /if ?}
{? else ?}
暂时没有试题
{? /if ?}
  </table> 
</div>